<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>时间序列预测</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f9f9f9;
            color: #333;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .container {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
            width: 100%;
            max-width: 800px;
            text-align: center;
        }
        h2 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 20px;
        }
        .form-section {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
            width: 100%;
            max-width: 800px;
            text-align: left;
        }
        .form-section:last-child {
            margin-bottom: 0; /* Remove bottom margin from the last section */
            box-shadow: none; /* Remove box shadow from the last section */
        }
        .file-upload {
            text-align: center;
            margin-bottom: 20px; /* Increased margin for better separation */
        }
        .file-input-container {
            position: relative;
            overflow: hidden;
            margin: 10px auto;
            width: 70%;
            max-width: 300px;
        }
        .file-input {
            margin-top: 5px;
            margin-bottom: 15px;
            width: calc(100% - 40px);
            padding: 10px;
            box-sizing: border-box;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .file-input-label {
            background-color: #3498db;
            color: #fff;
            padding: 12px 24px; /* Increased padding for better clickability */
            border-radius: 6px;
            cursor: pointer;
            display: inline-block;
            margin: 0 auto; /* Center the label horizontally */
            transition: background-color 0.3s ease; /* Smooth transition for hover effect */
        }
        .file-input-label:hover {
            background-color: #2980b9;
        }
        input[type="submit"] {
            background-color: #3498db;
            color: #fff;
            border: none;
            padding: 12px 24px; /* Increased padding for better clickability */
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            margin-top: 10px;
            display: block; /* Ensure button is block level for centering */
            margin: 0 auto; /* Center the button horizontally */
            transition: background-color 0.3s ease; /* Smooth transition for hover effect */
        }
        input[type="submit"]:hover {
            background-color: #2980b9;
        }
        input[type="number"] {
            width: 100%;
            max-width: 300px;
            text-align: center;
            padding: 12px; /* Increased padding for better input box size */
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 6px;
            margin-top: 10px;
            box-sizing: border-box; /* Ensure padding is included in the width */
        }
        input[type="number"]:focus {
            outline: none;
            border-color: #3498db; /* Highlight border color on focus */
        }
        h3 {
            color: #2c3e50;
            margin-top: 40px;
            margin-bottom: 10px;
            text-align: center;
        }
        h4 {
            color: #34495e;
            margin-top: 10px;
            margin-bottom: 5px;
        }
        p {
            line-height: 1.6;
            margin-bottom: 10px;
        }
        .table-container {
            width: 100%;
            margin-top: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            overflow-x: auto; /* Add horizontal scroll */
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
        }
    </style>
</head>
<body>
    <h2>执行时间序列预测</h2>
    
    <div class="form-section">
        <h3>  选择要分析的文件和输入分析时间</h3>
        <form action="/ts_pre" method="post" enctype="multipart/form-data">
            <div class="file-upload">
                <!-- <label for="file" class="file-input">选择文件</label> -->
                <input type="file" id="file" name="file" class="file-input">
            </div>

            <h3>请输入要预测的时间：</h3>
            <div style="text-align: center;">
                <br>
                <input type="number" id="predict_time" name="predict_time" min="1" max="100">
            </div>
            <br>
            
            <input type="submit" value="确认执行">
        </form>
    </div>

    <div class="form-section">
        <h3>本项目用作单变量的时间序列预测</h3>
        <p>支持的预测模型包括：LR（线性回归）、ARIMA、BP神经网络和LSTM。</p>
    </div>

    <div class="form-section">
        <h3>运行方式</h3>
        <p>本项目提供两种运行方式：</p>
        <ul>
            <li><strong>非周期性预测：</strong>直接进行预测，适用于不具有明显周期性的数据。</li>
            <li><strong>周期性预测：</strong>先进行周期性检测，再根据检测结果选择合适的预测模型。</li>
        </ul>
    </div>

    <div class="form-section">
        <h3>结果</h3>
        <p>不同模型的时间开销和准确率比较如下：</p>
        <div class="table-container">
            <table>
                <tr>
                    <th>模型</th>
                    <th>时间开销</th>
                    <th>准确率</th>
                    <th>开源包</th>
                </tr>
                <tr>
                    <td>LR（线性回归）</td>
                    <td>少</td>
                    <td>低</td>
                    <td>sklearn</td>
                </tr>
                <tr>
                    <td>ARIMA</td>
                    <td>少</td>
                    <td>低</td>
                    <td>statsmodels</td>
                </tr>
                <tr>
                    <td>BP神经网络</td>
                    <td>中等</td>
                    <td>中</td>
                    <td>pybrain</td>
                </tr>
                <tr>
                    <td>LSTM</td>
                    <td>大（需要GPU）</td>
                    <td>高</td>
                    <td>tensorflow</td>
                </tr>
            </table>
        </div>
    </div>

    <div class="form-section">
        <h3>建议</h3>
        <p>根据数据的特性选择适合的预测方式：<br>
        如果数据不具有明显的周期性，建议选择非周期性预测模式；如果数据具有周期性，可以考虑周期性预测模式，根据周期性检测结果选择合适的模型进行预测。</p>
    </div>
</body>
</html>
